package com.android.juguotang.fragment.member;

import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;

import com.android.juguotang.R;
import com.android.juguotang.fragment.BaseLazyFragment;
import com.android.juguotang.utils.MyLog;

import butterknife.BindView;
import butterknife.ButterKnife;

public class Fragment_Mine_Accounts extends BaseLazyFragment {
    @BindView(R.id.pay_radio_express)
    RadioButton payRadioExpress;
    @BindView(R.id.pay_radio_self)
    RadioButton payRadioSelf;
    @BindView(R.id.pay_radio_ll)
    RadioGroup payRadioLl;
    @BindView(R.id.fl_accounts)
    FrameLayout fl_accounts;

    private FragmentActivity mcontext;
    private View view;

    public Fragment_Mine_Accounts() {

    }
    public static Fragment_Mine_Accounts newInstance(String price) {
        Fragment_Mine_Accounts fragment = new Fragment_Mine_Accounts();
        Bundle args = new Bundle();
//        args.putString(ARG_PARAM1, price);
        fragment.setArguments(args);
        return fragment;
    }



    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    private boolean isCheck = true;

    @Override
    protected void initPrepare() {
        final FragmentManager fm =  getActivity().getSupportFragmentManager();
        fm.beginTransaction().replace(R.id.fl_accounts, Fragment_Mine_Accounts_Online.newInstance("")).commit();

        payRadioExpress.setChecked(true);
        payRadioLl.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i) {
                int radioButtonId = radioGroup.getCheckedRadioButtonId();
                if (radioButtonId == R.id.pay_radio_express) {
                    isCheck = true;
                    MyLog.e("inest","isCheck = true;");

                    fm.beginTransaction().replace(R.id.fl_accounts, Fragment_Mine_Accounts_Online.newInstance("")).commit();


//                    express_id = "12";
//                    payAddress.setVisibility(View.VISIBLE);

//                    pay_address_take_ll.setVisibility(View.GONE);
                } else {
                    isCheck = false;
                    MyLog.e("inest","isCheck = false;");
                    fm.beginTransaction().replace(R.id.fl_accounts, Fragment_Mine_Accounts_Card.newInstance("")).commit();

//                    express_id = "10";
//                    pay_address_take_ll.setVisibility(View.VISIBLE);
//                    payAddress.setVisibility(View.GONE);
            }
            }
        });
    }

    @Override
    protected void onInvisible() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment__mine__accounts, container, false);
        ButterKnife.bind(this, view);
        mcontext = getActivity();


        return view;
    }


}
